﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ModbusReadAndWrite.MasterStation
{
    class Master
    {
        public int MasterId { set; get; }

        public byte[] Message { get; set; }
        
        public Master(int id, byte[] messages)
        {
            this.MasterId = id;
            this.Message = messages;
        }

        //用于获取消息string类型报文打印
        public override string ToString()
        {
            var mes = this.Message;
            var sb = new StringBuilder();
            
            sb.Append("Message comes from slave station:").Append(this.MasterId).Append("\nmessage content is:");
            foreach (var m in mes)
            {
                sb.Append(m).Append(" ");
            }

            return sb.ToString();
        }
    }
}
